package com.zfzs.post.exception.handler;

import com.zfzs.post.common.bean.ResponseCode;
import com.zfzs.post.common.bean.ResponseResult;
import com.zfzs.post.common.bean.ResponseCode;
import com.zfzs.post.common.bean.ResponseResult;
import com.zfzs.post.common.bean.ResponseCode;
import com.zfzs.post.common.bean.ResponseResult;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @description: 处理404异常
 * @author: ck
 * @create: 2019-06-03 13:04
 **/
@Controller
public class NotFoundException implements ErrorController {

    @Override
    public String getErrorPath() {
        return "/error";
    }

    @RequestMapping(value = {"/error"})
    @ResponseBody
    public ResponseResult error(HttpServletRequest request) {
        return ResponseResult.error(ResponseCode.NOT_FOUND_ERROR);
    }
}
